import * as events from "./events";

const mutations = {
  [events.SET_SID]: function(state, data) {
    state.sid = data;
  },
  [events.APP_HAS_LOGIN]: function(state) {
    state.appHasLogin = true;
  },
  changeBtmRouteArr(state, itemObj) {
    // 判断底部路由arr存储是否已经有
    let flag = state.btmRouteArr.some((item) => {
      return item.name === itemObj.name;
    });
    if (!flag) {
      state.btmRouteArr.push(itemObj);
    }
  },
  operationBtmRouteArr(state, operationObj) {
    let { type, name } = operationObj;
    if (type === "close") {
      state.btmRouteArr = state.btmRouteArr.filter((item) => {
        return item.name != name;
      });
    }
  },
  // 是否需要重新获取推送数据  在操作删除忽略标签时触发
  operationIsReGetTuisong(state, data) {
    state.isReGetTuisong = data
  },
};
export default mutations;
